package com.example.peibei.ui.adapter;

import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.GetOrder;
import com.dingtao.common.bean.Order;
import com.example.peibei.R;

import java.util.List;

public class CommentListAdapter extends BaseQuickAdapter<Order.RecordsDTO, BaseViewHolder> {
    int status;

    public CommentListAdapter(@Nullable List<Order.RecordsDTO> data, int status) {
        super(R.layout.item_order_get, data);
        this.status = status;
    }

    @Override
    protected void convert(BaseViewHolder helper, Order.RecordsDTO item) {
        ImageView head = helper.getView(R.id.iv_head);
        Glide.with(getContext()).load(item.getMember().getImgUrl()).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(head);
        helper.setText(R.id.tv_time, item.getDate()).setText(R.id.tv_name, item.getMember().getNickName()).setText(R.id.tv_address, item.getMember().getArea()).setText(R.id.tv_price, item.getPrice() + "")
                .setText(R.id.tv_dec, item.getContent()).setText(R.id.tv_category, item.getCategory());
        Button bt_to_comment = helper.getView(R.id.bt_to_comment);
//        bt_to_comment.setVisibility(View.VISIBLE);
        if (status == 0) bt_to_comment.setText("去评价");
        else bt_to_comment.setText("去追评");
    }
}
